package brickBreaker;

import states.SlickGame;

import org.lwjgl.input.Mouse;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.TrueTypeFont;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.state.StateBasedGame;

import buttons.CircleToggleButton;
import globals.PauseAbstract;

public class BreakerPause extends PauseAbstract {
	// boolean isPaused; inherited from abstract.
	// int pauseState
	// ---- Buttons here -----
	CircleToggleButton gotoMenu;
	TrueTypeFont fontLarge;
	
	public BreakerPause(){
		isPaused=true;
		pauseState=initialState;
		gotoMenu=new CircleToggleButton(SlickGame.width/2,(int) (SlickGame.height*0.7),50,"Menu",Color.blue,Color.green,Color.blue.darker((float) 1.4));
	}
	
	public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
		fontLarge=new TrueTypeFont(new java.awt.Font("Times New Roman",0,48), true);
	}
	
	public void update(StateBasedGame sbg, int delta) {
		gotoMenu.update(Mouse.getX(), SlickGame.height-Mouse.getY(), Mouse.isButtonDown(0), delta);
		
		if(gotoMenu.isClicked()){
			gotoMenu.clicked=false;
			this.pauseState=initialState;
			sbg.enterState(SlickGame.menu);
		}
		
	}

	public void draw(Graphics g) {
		g.setColor(gray70);
		g.fill(new Rectangle(0, 0, SlickGame.width, SlickGame.height));
		
		g.setColor(new Color((float)(0.886),(float)(0.886),(float)(0.886)));// silver
		g.setFont(fontLarge);
		int tWidth=g.getFont().getWidth("Brick Breaker!");
		g.drawString("Brick Breaker!", SlickGame.width/2-tWidth/2, 100);
		g.resetFont();
		
		gotoMenu.draw(g);
		
		
	}

}
